Skip to content

Conversation

@nicolas-grekas
Copy link
Member

Related to symfony/symfony#59106

I'm wondering why we don't have the User object this way: aka why do we need a serialize function? And why don't we erase the password? Yes it's hashed, but removing it is still better to me.

Anything I'm missing?
@chalasr @stof maybe?

@chalasr
Copy link
Member

chalasr commented Jan 17, 2025

I think symfony/symfony#59106 (comment) invalidates this

@nicolas-grekas
Copy link
Member Author

@stof
Copy link
Member

stof commented Jan 17, 2025

Another valid reason to use __serialize is that a real-world project might have additional relations in their User entity (for other reasons that the authentication) and you would not want to have all of them included in the serialized payload (which might even trigger initialization of proxies depending on whether serialization triggers it or no).
And if serialization does not automatically triggers the initialization of proxies, you would need this __serialize performing property access that would ensure that Doctrine initializes the proxy.

Copy link
Member Author

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would require symfony/symfony#59539

@xabbuh xabbuh deleted the erase-pwd branch January 17, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants